package com.eddy.liveline.core.web.controller;

import org.apache.commons.lang.text.StrBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author : 宋浩志
 * @createDate : 2018年9月6日
 */
public class BaseController {
	/** 日志 **/
	protected final Logger log = LoggerFactory.getLogger(getClass());

	// 默认主题
	public static String THEME_NAME = "pinghsu";

	public static String WORLD = "world";

	/**
	 * 根据主题名称渲染页面
	 *
	 * @param pageName
	 *            pageName
	 * @return 返回拼接好的模板路径
	 */
	public String render(String pageName) {
		//加载主题
		StrBuilder themeStr = new StrBuilder("themes/");
		themeStr.append(THEME_NAME);
		themeStr.append("/");
		return themeStr.append(pageName).toString();
	}

	public String render_world(String pageName) {
		StrBuilder worldStr = new StrBuilder(WORLD);
		worldStr.append("/");
		return worldStr.append(pageName).toString();
	}


	/**
	 * 404页面
	 * 
	 * @return
	 */
	public String render_404() {
		return "error/404";
	}
}
